/*    */
package com.liang.nansheng.common.utils;
/*    */
/*    */

import java.util.Random;

/*    */
/*    */ public class VerifyCodeUtils
        /*    */ {
    /*    */   private static final String VERIFY_CODES = "1234567890";

    /*    */
    /*    */
    public static String generateVerifyCode(int verifySize)
    /*    */ {
        /* 24 */
        return generateVerifyCode(verifySize, "1234567890");
        /*    */
    }

    /*    */
    /*    */
    public static String generateVerifyCode(int verifySize, String sources)
    /*    */ {
        /* 35 */
        if ((sources == null) || (sources.length() == 0)) {
            /* 36 */
            sources = "1234567890";
            /*    */
        }
        /* 38 */
        int codesLen = sources.length();
        /* 39 */
        Random rand = new Random(System.currentTimeMillis());
        /* 40 */
        StringBuilder verifyCode = new StringBuilder(verifySize);
        /* 41 */
        for (int i = 0; i < verifySize; i++) {
            /* 42 */
            verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1)));
            /*    */
        }
        /* 44 */
        return verifyCode.toString();
        /*    */
    }
    /*    */
}

/* Location:           C:\maven\maven3.5\maven3.5\repositor\io\github\maliangnansheng\nansheng-common\3.3.4\nansheng-common-3.3.4.jar
 * Qualified Name:     com.liang.nansheng.common.utils.VerifyCodeUtils
 * JD-Core Version:    0.6.2
 */